/**
 * Description:
 * Class Name:LockTest
 * Date:2022/5/7 10:06
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第16章_多线程._16_5_同步线程._16_5_5_同步锁Lock;

public class LockTest extends Thread{
    private LockAccount account;
    private double drawAmount;
    public LockTest(String name, LockAccount account, double drawAmount){
        super(name);
        this.account = account;
        this.drawAmount = drawAmount;
    }

    @Override
    public void run() {
        account.draw(drawAmount);
    }

    public static void main(String[] args) {
        var account = new LockAccount("1234567", 1000);
        // 连续两次取钱操作
        new LockTest("甲", account, 800).start();
        new LockTest("乙", account, 800).start();
    }
}
